#This script reads the utt2spk file and creates a utt2genderid file
import sys

def main():
    data_dir=sys.argv[1]
    print data_dir
    #data_dir='exp_pdnn/dnn6_fbank_new/data/train/'
    utt2spk_file = open(data_dir+'utt2spk','r')
    utt2genderid_file = open(data_dir+'label','w')

    for line in utt2spk_file:
        temp_array = (line.rstrip()).split()
        label ='0'
        if temp_array[0].startswith('M'):
            label='1'
        utt2genderid_file.writelines(temp_array[0]+' '+label +'\n')
    utt2spk_file.close()
    utt2genderid_file.close()

if __name__=="__main__":
    main()

